﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Schedule
{
    public partial class AddDeadlineForm : Form
    {
        int Weekday { set; get; }
        int ChooseLesson { set; get; }

        public AddDeadlineForm(int weekday,int chooseLesson)
        {
            InitializeComponent();
            Weekday = weekday;
            ChooseLesson = chooseLesson;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (taskTxt.Text == "")
            {
                MessageBox.Show("请输入任务名称");
                return;
            }
            if(dateTimePicker1.Value < DateTime.Now )
            {
                MessageBox.Show("日期不合法，请重新选择日期");
                return;
            }
            if(!new DDLManage().addDDL(Weekday,ChooseLesson,taskTxt.Text.ToString(),dateTimePicker1.Value.ToString("yyyy-MM-dd")))
                MessageBox.Show("无课程，添加ddl失败");
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
        {

        }
    }
}
